﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using static Modules.Audit.SysAuditLogConstants;
using static Modules.Project.ProjectConstants;
using static Modules.Project.ProjectLockLogConstants;

namespace Modules
{
    /// <summary>
    /// 项目解上锁记录
    ///</summary>
    [TableName("project_lock_log")]
    [Description("项目解,上锁记录")]
    [PrimaryKey("id", AutoIncrement = true)]
    [CacheSetting(true, PropertyNamesOfArea = "ProjectId")]
    [Serializable]
    public class ProjectLockLog : IEntity
    {
        /// <summary>
        ///
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 编号
        ///</summary>
        [Column("code")]
        public string Code { get; set; }

        /// <summary>
        /// 项目Id
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 是否上锁0 否 1 是
        ///</summary>
        [Column("has_locked")]
        public bool HasLocked { get; set; }

        /// <summary>
        /// 锁定月份
        ///</summary>
        [Column("lock_month")]
        public int LockMonth { get; set; }

        /// <summary>
        /// 锁定原因
        ///</summary>
        [Column("lock_reason")]
        public string? LockReason { get; set; }

        /// <summary>
        /// 锁定时间
        ///</summary>
        [Column("lock_time")]
        public DateTime? LockTime { get; set; }

        /// <summary>
        /// 上锁时项目状态
        ///</summary>
        [Column("lock_prj_status")]
        public 项目状态? LockPrjStatus { get; set; }

        /// <summary>
        /// 解锁时间
        ///</summary>
        [Column("unlock_time")]
        public DateTime? UnlockTime { get; set; }

        /// <summary>
        /// 申请解锁原因
        ///</summary>
        [Column("unlock_reason")]
        public string? UnlockReason { get; set; }

        /// <summary>
        /// 解锁申请人
        ///</summary>
        [Column("unlock_applicant")]
        public string? UnlockApplicant { get; set; }

        /// <summary>
        /// 解锁申请时间
        ///</summary>
        [Column("unlock_application_time")]
        public DateTime? UnlockApplicationTime { get; set; }

        /// <summary>
        /// 是否已推送一体化平台   0：否 1：是
        ///</summary>
        [Column("has_push")]
        public bool HasPush { get; set; }

        /// <summary>
        /// 推送时间
        ///</summary>
        [Column("push_time")]
        public DateTime? PushTime { get; set; }

        /// <summary>
        /// 创建时间
        ///</summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 推送结果 0：推送失败 1推送成功
        ///</summary>
        [Column("push_result")]
        public int? PushResult { get; set; }

        /// <summary>
        /// 推送结果回复
        ///</summary>
        [Column("push_response")]
        public string? PushResponse { get; set; }

        /// <summary>
        /// 推送结果回复时间
        ///</summary>
        [Column("push_response_time")]
        public DateTime? PushResponseTime { get; set; }

        /// <summary>
        /// 数据来源
        /// </summary>
        [Column("data_sourse")]
        public 解锁数据来源? DataSourse { get; set; }

        /// <summary>
        /// 最后一次操作时间
        ///</summary>
        [Column("last_update_time")]
        public DateTime? LastUpdateTime { get; set; }

        /// <summary>
        /// 审核状态
        /// </summary>
        [Column("audit_status")]
        public 解上锁审核状态? AuditStatus { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [Column("audit_person")]
        public string? AuditPerson { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        [Column("audit_time")]
        public DateTime? AuditTime { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        [Column("audit_idea")]
        public AuditIdea? AuditIdea { get; set; }

        /// <summary>
        /// 意见说明
        /// </summary>
        [Column("audit_idea_content")]
        public string? AuditIdeaContent { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return this.Id; } }

        #endregion IEntity 成员
    }
}